<template>
  <ul class="table">
    <li
      class="pointer "
      :class="{'act':index+1 == itemNum}"
      v-for="(item,index) in reg_people_names"
      @click="selectName(index)"
    >{{item}}</li>
  </ul>
</template>

<script>
export default {
  name: "searchList",
  props: [
      "reg_people_names",//注册人，后台返回的数组
      "type",
      "itemNum",//选中高亮

      //0引用页面=》检索查询，页面跳转
      //1保留页面，执行属性函数
      "state",

       //1 商标 ，0 专利
      "category"
    ],
  data() {
    return {
      query_key: "" // 名字
    };
  },
  methods: {
    // 选择模糊名字
    selectName(index) {
      let {
        $route: { name }
      } = this;

      this.query_key = this.reg_people_names[index];

      if (this.category == 1) {//商标
        if (this.state == 0) {
          $app.closeHadPage("Trademarklists", () => {
            $app.closeTag({ name }); // 关闭自己本页面
            // 页面跳转
            this.$router.push({
              name: "Trademarklists",
              query: {
                query_key: this.query_key,
                type: this.type
              }
            });
          });
        } else {
          this.$emit("select_name", index);
        }
      } else {//专利
        if (this.state == 0) {
          $app.closeHadPage("patentList", () => {
            //关闭指定页面
            $app.closeTag({ name });
            // 页面跳转
            this.$router.push({
              name: "patentList",
              query: {
                query_key: this.query_key,
                type: this.type
              }
            });
          });
        } else {
          this.$emit("select_name", this.query_key);
        }
      }
    }
  }
};
</script>

<style scoped>
</style>